{load header}
<!--/H-->
    <!-- 内容区 -->
    <div id="main-content">
        <div id="top-alert" class="fixed alert alert-error" style="display: none;">
            <button class="close fixed" style="margin-top: 4px;">&times;</button>
            <div class="alert-content">这是内容</div>
        </div>
        <div id="main" class="main">
            
            <!-- nav -->
                        <!-- nav -->
            

            
	<div class="main-title">
        <h2>在线溜溜币充值</h2>
    </div>
    <div class="cf">
	</div>
	    
    <div class="data-table">
        <div class="data-table table-striped">
            <form action="" method="post" class="form-horizontal">
			<!-----table----->
                        <table class="table table-hover" style="width: 30%;">
				<thead>
				<tr>
					<th width='25%'>选项名称</th>
					<th width='75%'>选项值</th>
				</tr>
				</thead>
				<tbody>
                                    <tr>
                                        <td>充值用户：</td>
                                        <td><input type="text" id="username" name="username" value="" class="text">（用户名）</td>
                                    </tr>
                                    <tr>
                                        <td>充值金额：</td>
                                        <td><input type="text" id="amount" name="amount" value="" class="text">（元）</td>
                                    </tr>
				</tbody>
			</table>
                        <br/>
			<div class="form-item">
                        <input type='hidden' id="order_nid" name="order_nid" value="{$item['order_nid']}"/>
                        <a  href="javascript:void(0);" class="btn submit-btn" id="submit_yes" target-form="form-horizontal">确定充值</a>
		</div>
            </form>
			<!-----/table----->
			<!-- 分页 -->
		</div>
    </div>
	
	
			</div>
	</div>
<script type="text/javascript">
$(function(){
    $(".submit-btn").click(function(){
        var that = this;
        var _username = $.trim($("#username").val());
        var _amount = $.trim($("#amount").val());
        if(_username == ""){
            alert("用户名不能为空");return;
        }
        if(_amount == "" || _amount == 0){
            alert("充值金额需大于等于1");return;
        }
        $.ajax({
            url:"",async: false,dataType:"json",type:"post",data:{username:_username,amount:_amount},
            success:function(data){
		if (data.status==1) {
                    if (data.url) {
                        updateAlert(data.info + ' 页面即将自动跳转~','alert-success');
                    }else{
                        updateAlert(data.info ,'alert-success');
                    }
                    setTimeout(function(){
                        if (data.url) {
                            location.href=data.url;
                        }else if( $(that).hasClass('no-refresh')){
                            $('#top-alert').find('button').click();
                            $(that).removeClass('disabled').prop('disabled',false);
                        }else{
                            location.reload();
                        }
                    },1500);
                }else{
                    updateAlert(data.info);
                    setTimeout(function(){
                        if (data.url) {
                            location.href=data.url;
                        }else{
                            $('#top-alert').find('button').click();
                            $(that).removeClass('disabled').prop('disabled',false);
                        }
                    },1500);
                }
            }
        });
    });
});	
</script>
<!--F-->{load footer}